From 26c54bf9fae60f6e63bf49cd1591617bd8fd9e4a Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 19 May 2009 01:17:16 +0100 Subject: [PATCH] x86: Use PGC_cacheattr_mask rather than a hardcoded constant. Signed-off-by: Patrick Colp --- xen/arch/x86/mm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index d11c2a1ce4..dce0fbbe1a 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -766,7 +766,7 @@ get_page_from_l1e( goto could_not_pin; if ( pte_flags_to_cacheattr(l1f) != - ((page->count_info >> PGC_cacheattr_base) & 7) ) + ((page->count_info & PGC_cacheattr_mask) >> PGC_cacheattr_base) ) { unsigned long x, nx, y = page->count_info; unsigned long cacheattr = pte_flags_to_cacheattr(l1f); @@ -782,7 +782,7 @@ get_page_from_l1e( return 0; } - while ( ((y >> PGC_cacheattr_base) & 7) != cacheattr ) + while ( ((y & PGC_cacheattr_mask) >> PGC_cacheattr_base) != cacheattr ) { x = y; nx = (x & ~PGC_cacheattr_mask) | (cacheattr << PGC_cacheattr_base); @@ -2389,7 +2389,8 @@ int get_page_type_preemptible(struct page_info *page, unsigned long type) void cleanup_page_cacheattr(struct page_info *page) { - uint32_t cacheattr = (page->count_info >> PGC_cacheattr_base) & 7; + uint32_t cacheattr = + (page->count_info & PGC_cacheattr_mask) >> PGC_cacheattr_base; if ( likely(cacheattr == 0) ) return; -- 2.30.2